package net.monare.mifss.admin.ui.win;

import com.vaadin.ui.Label;
import com.vaadin.ui.NativeButton;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.themes.Runo;
import net.monare.mifss.MifssMessages;
import net.monare.mifss.configurations.pojo.ApiKey;
import net.monare.mifss.evn.RemoveSelectedApiKeyListener;

/**
 * Created by jernej on 4/22/14.
 */
public class RemoveApiKeyWindow extends Window {

    public  RemoveApiKeyWindow(ConfigureStorageWindow parent ,ApiKey apiKey, String storageDefName){

        setStyleName(Runo.WINDOW_DIALOG);
        setModal(true);
        setCaption(MifssMessages.getMessage("title.warning"));

        VerticalLayout layout = new VerticalLayout();

        layout.setMargin(true);
        layout.setSpacing(true);

        Label warningLabel = new Label(MifssMessages.getMessage("sys.warning.remove.api.key") + " : " + apiKey.getName() + " ?");


        NativeButton removeApiKey = new NativeButton(MifssMessages.getMessage("button.remove"));
        removeApiKey.addClickListener(new RemoveSelectedApiKeyListener(parent, this, apiKey, storageDefName));

        layout.addComponent(warningLabel);
        layout.addComponent(removeApiKey);
        setContent(layout);

    }

}
